cmake_minimum_required(VERSION 3.0)
set(TargetName nc)
project(${TargetName})

set(SOURCES_files_SourceFiles
  netcat.c
  getopt.c
  doexec.c      
)

set(SOURCES_files_HeaderFiles
)
source_group("Source Files" FILES ${SOURCES_files_SourceFiles})
source_group("Header Files" FILES ${SOURCES_files_HeaderFiles})

set(SOURCES_SourceFiles
  ${SOURCES_files_SourceFiles}
  ${SOURCES_files_HeaderFiles}
)
set(SOURCES_
${SOURCES_SourceFiles}
${SOURCES_files_HeaderFiles}
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/inc/)

  if(WIN32)	
   SET(CMAKE_CXX_FLAGS_DEBUG "/MDd /Z7 /Od")
   SET(CMAKE_CXX_FLAGS_RELEASE "/MD /O2")
   SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O2")
   SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MDd /Z7 /Od")
endif(WIN32)

SET(ProjectName nc)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Platform Toolset" FORCE)
SET(CMAKE_MFC_FLAG 2)
Add_Definitions(-DUNICODE -D_UNICODE -DWIN32 -D_CONSOLE -DTELNET -DGAPING_SECURITY_HOLE)
LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)
ADD_EXECUTABLE(${ProjectName} ${SOURCES_})
TARGET_LINK_LIBRARIES(${ProjectName} ws2_32 winmm)

if(NOT WIN32)
add_definitions(-D_PORT_VERSION -Wno-deprecated  -fPIC)
if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "Release" OR "MinSizeRel" OR "RelWithDebInfo")
add_definitions(-DNDEBUG)
endif(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "Release" OR "MinSizeRel" OR "RelWithDebInfo")
endif(NOT WIN32)
